<?php use_helper('Date');?>

<?php 
$history = $dossier->getStatesList(false, true); ?>

<?php if(count($history) > 0):?>
  	<fieldset><legend><?php echo __('Process history')?></legend>
	  	<table class='historique'>
	  	<tbody>
		  <?php foreach($history as $etat):?>
		  	<?php if($etat['visibilite']==1)
		  	{
		  		$visible = true;
		  	}
		  	else
		  	{
		  		//TODO FAIRE LE FILTRE PAR VISIBILITÉ
		  		$visible = true;
		  		//Faut voir
		  		//$personne = $sf_user->getUserProfile();
		  		//$visible = $personne->peutVoirEtat($demande, $etat);
		  	}
		  	if($visible):
		  	?>
			<tr>
		      <th width = "16%" style="text-align: center;"><?php echo format_date($etat['created_at']) ?></th>
		      <td style="text-align: center;"><?php echo $etat['personne']['name']; ?></td>
		      <td width = "16%" style="text-align: center;"><?php echo $etat['etat']['description']; ?>
		      </td>
		      <td width = "50%" style="text-align: center;"> <?php 
		      	 echo $etat['commentaire'];
		      	?></td>
		    </tr>
		    <?php endif;?>
		  <?php endforeach;?>
		</tbody>
	  	</table>
  	</fieldset>
<?php endif;?>

<?php if($showNextStage):?>
	<?php if(!$dossier->ferme and stripos($sf_request->getPathInfo(), 'processAction')===false):?>
	<fieldset><legend><?php echo __('The next stage')?></legend>
	<table>
	  <tbody>
	    <tr>
	      <th width="50%"><?php echo __('The next stakeholder is:')?></th>
	      <td width="50%" id="nextValideur_name" ><?php echo $dossier->getNomActeur();  ?></td>
	    </tr>
	  </tbody>  
	</table>
	</fieldset>
	<?php endif;?>
<?php endif;?>
